<template>
  <el-dialog title="选择风险点" :close-on-click-modal="false" :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll append-to-body width="1200px">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <div class="JNPF-common-search-box-right">
        <el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
          <el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false" @click="refresh()" />
        </el-tooltip>
      </div>
    </el-row>
    <!-- <JNPF-table v-loading="listLoading" :data="list" hasC @selection-change="handleSelectionChange" :border="false"> -->
    <JNPF-table v-loading="listLoading" :data="list" @selection-change="handleSelectionChange" :border="false">
      <el-table-column prop="mc" label="名称"/>
      <el-table-column prop="lx" label="类型"  />
      <el-table-column prop="qumc" label="区域名称"  />
      <el-table-column label="操作" fixed="right" width="150">
          <template slot-scope="scope">
            <el-button type="text" @click="select(scope.row)" >选中</el-button>
          </template>
			</el-table-column>
    </JNPF-table>
    <!-- <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="init" /> -->
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">{{
        $t("common.cancelButton")
      }}</el-button>
      <!-- <el-button type="primary" @click="select()">{{
        $t("common.confirmButton")
      }}</el-button> -->
    </span>
  </el-dialog>
</template>

<script>
import request from '@/utils/request'
import { GoodsList } from "@/api/extend/order";
export default {
  data() {
    return {
      visible: false,
      listLoading: true,
      keyword: "",
      list: [],
      // total: 0,
      checked: [],
      query: {},
      listQuery: {
					// currentPage: 1,
					// pageSize: 20,
          // sort: "desc",
          // sidx: "",
      },
      sbztOptions:[{"fullName":"报废","id":"0"},{"fullName":"停用","id":"1"},{"fullName":"备件","id":"2"},{"fullName":"启用","id":"3"}],
    };
  },
  created(){
    this.init();
  },
  methods: {
    init() {
      this.visible = true;
      this.listLoading = true;
      let query = {
      };
      request({
        url: `/api/System/YHPCXXFXD`,
            method: 'POST',
            data: query
        }).then(res => {
          // console.log(res);
            this.list = res.data;
            this.listLoading = false;
            // this.total = res.data.pagination.total;
            this.$nextTick(() => {
                this.tableHeight = "100%"
        });
      })  
    },
    refresh() {
      // this.keyword = "";
      this.init();
    },
    select(row) {
      // if (!this.checked.length) return;
      this.visible = false;
      this.$emit("refreshDataList", row);
    },
    handleSelectionChange(val) {
      this.checked = val;
    },
  },
};
</script>
<style lang="scss" scoped>
>>> .el-dialog__body {
  height: 70vh;
  padding: 0 0 10px !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  .JNPF-common-search-box {
    margin-bottom: 0;
    .JNPF-common-search-box-right {
      padding: 10px 10px 0 0;
    }
  }
}
</style>